Appendix: Source files
In case you are interested in how CGI scripts can be written, or if you
want to compare your attempt at the exercises with mine, here are
the Perl files used to generate them.
-
Environment example: Generates an HTML document
listing the values of (most of) the current environment
variables.
-
The endless document: Displays one of the many(!) pages
of a document with infinitely many pages. It uses the
QUERY_STRING environment variable to see what page it should
generate and what the previous page was. The
first page can be found at
http://agora.leeds.ac.uk/Perl-cgi/endless?1.
-
&read_input: Just a Perl subroutine to translate
URL-encoded information from the QUERY_STRING environment variable.
It also handles the POST method transparently. This subroutine
is a version of part of the
cgi-lib.pl
library of such routines.
-
Serve tea: Tells you what drink you've ordered and
that we've just sold out of your favourite cream cake (if any).
It takes input from the
Tea Sever.
-
Text area example: Comments on the contents of a text
area. It is triggered by the last example on the page
about
text areas and the POST method.